from lxml import etree

# xml_str = """
# <root>
#     <child>
#         <name>James</name>
#         <age>18</age>
#     </child>
# </root>
# """

xml_str = """
<root id='a110'>
    hello world
    <p>哈哈哈</p>
</root>
"""
# XML的对象一定要是闭合的标签，不然会报错
# tree = etree.XML(xml_str)
# print(dir(tree))
# text = tree.text
# print(text)
# print(tree.attrib)
#
# child = tree.find('p')
# print(child)

"""
方法
XML
html
parse 解析文件
fromstring  解析远程文件/URL

用法
 find
 findall
 
 获取元素
text
tag
attrib

"""
